﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess;
using Entities;
using ATM.Utility.Constants;
namespace Bussiness
{
    public class CardBLL : ICardBLL
    {

        private static CardBLL install;
        public static CardBLL Install
        {
            get
            {
                if (install == null)
                    install = new CardBLL();
                return install;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="cardID"></param>
        /// <returns>
        ///Nomal = 0,
        ///TemporaryLock = 1,
        ///PermanentlyLock = 2,
        ///Expired = 3
        /// </returns>
        public int ValidateCard(string cardID)
        {

            var card = CardDao.Install.GetCard(cardID);
            if (card == null)
                return -1;
            else
            {
                return card.Status;
            }
        }
        public int AutheticationUser(Account account)
        {
            return 0;
        }
        public bool Block(Card card)
        {
            return true;
        }
        public int ChangePIN(string cardID, string newPIN)
        {
            return CardDao.Install.ChangePin(cardID, newPIN);
        }


    }
}
